<template>
  <div>
    <toptop></toptop>
    <router-view ></router-view>
  </div>
</template>

<script>
import axios from "axios";
import toptop from "../components/toptop.vue";
export default {
  name: "index",
  data() {
    return {
      data() {
        return {
          username: "",
          school: "",
        };
      },
    };
  },
  components: {
    toptop,
  },
  methods: {},
  created() {
    console.log("11");
    // this.$router.push({ name: "homePage" });
  },

  mounted() {
    console.log(this.$route.query.username);
    console.log(this.$route.query.identity);
    this.identity=this.$route.query.identity;
    axios
      .post("http://localhost:3000/api/user/LoginQuery", {
        username: this.$route.query.username,
        identity: this.$route.query.identity,
      })
      .then((response) => {
        console.log(response);
        // this.username=response.data[0].userName;
        //  console.log(this.username);
        this.username = response.data[0].userName;
        this.school = response.data[0].school;
        console.log(this.username, this.school);
        this.$router.push({
          name: "homePage",
          query: { username: this.username, school: this.school ,identity:this.identity},
        });
      });
  },
};
</script>

<style scoped>
@import "../assets/css/Index.css";
</style>